package com.example.SBootDemo.Util.MINA.code;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

public class codeFactory implements ProtocolCodecFactory{

	 private ProtocolEncoder encoder;  
	    private ProtocolDecoder decoder;  
	  
	    public codeFactory(boolean client) {  
	        if (client) {  
	            encoder = new Encoder();  
	            decoder = new Decoder();  
	        } else {  
	            encoder = new Encoder();  
	            decoder = new Decoder();  
	        }  
	    }  
	  
	    public ProtocolEncoder getEncoder(IoSession ioSession) throws Exception {  
	        return encoder;  
	    }  
	  
	    public ProtocolDecoder getDecoder(IoSession ioSession) throws Exception {  
	        return decoder;  
	    }  
}
